/////////////////////////////////////////////////////////////////////////////
// Name:        ax_settings_librarypage.h
// Purpose:     
// Author:      Julian Smart
// Modified by: 
// Created:     09/12/2008 18:03:17
// RCS-ID:      
// Copyright:   (c) Anthemion Software Limited
// Licence:     New BSD License
/////////////////////////////////////////////////////////////////////////////

#ifndef _AX_SETTINGS_LIBRARYPAGE_H_
#define _AX_SETTINGS_LIBRARYPAGE_H_

/*
 * Includes
 */

////@begin includes
////@end includes

/*
 * Forward declarations
 */

////@begin forward declarations
////@end forward declarations

class AxResourceLibrarySettings;
class AxResourceLibrary;

/*
 * Control identifiers
 */

////@begin control identifiers
#define SYMBOL_AXLIBRARYSETTINGSPAGE_STYLE wxTAB_TRAVERSAL
#define SYMBOL_AXLIBRARYSETTINGSPAGE_TITLE _T("")
#define SYMBOL_AXLIBRARYSETTINGSPAGE_IDNAME ID_AXLIBRARYSETTINGSPAGE
#define SYMBOL_AXLIBRARYSETTINGSPAGE_SIZE wxSize(400, 300)
#define SYMBOL_AXLIBRARYSETTINGSPAGE_POSITION wxDefaultPosition
////@end control identifiers


/**
    @class AxLibrarySettingsPage
    
    A predefined panel for editing resource library settings using a conventional UI.

    @category{ax_resource}
 */

class AxLibrarySettingsPage: public wxPanel
{    
    DECLARE_DYNAMIC_CLASS( AxLibrarySettingsPage )
    DECLARE_EVENT_TABLE()

public:
    /// Constructors
    AxLibrarySettingsPage();
    AxLibrarySettingsPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER|wxTAB_TRAVERSAL);

    /// Creation
    bool Create(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxNO_BORDER|wxTAB_TRAVERSAL);

    /// Destructor
    ~AxLibrarySettingsPage();

    /// Initialises member variables
    void Init();

    /// Creates the controls and sizers
    void CreateControls();

    /// Initialize with settings object. Must be called after panel
    /// is created.
    void Initialize(AxResourceLibrary* library, AxResourceLibrarySettings* settings);

    /// Lists files in additional paths
    void PopulateAdditionalPaths();

    /// Data transfer
    virtual bool TransferDataToWindow();
    virtual bool TransferDataFromWindow();
    
    /// Check can consolidate library file
    void CheckConsolidate();

    /// Set/get settings
    void SetSettings(AxResourceLibrarySettings* settings) { m_settings = settings; }
    AxResourceLibrarySettings* GetSettings() const { return m_settings; }

    /// Set/get resource library
    void SetLibrary(AxResourceLibrary* library) { m_library = library; }
    AxResourceLibrary* GetLibrary() const { return m_library; }

////@begin AxLibrarySettingsPage event handler declarations

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_PREFERENCES_MAIN_PATH_BROWSE
    void OnLibraryPreferencesMainPathBrowseClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_PREFERENCES_ADD
    void OnLibraryPreferencesAddClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_PREFERENCES_REMOVE
    void OnLibraryPreferencesRemoveClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_LIBRARY_PREFERENCES_REMOVE
    void OnLibraryPreferencesRemoveUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_PREFERENCES_ADD_FILE_TYPE
    void OnLibraryPreferencesAddFileTypeClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_PREFERENCES_REMOVE_FILE_TYPE
    void OnLibraryPreferencesRemoveFileTypeClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_LIBRARY_PREFERENCES_REMOVE_FILE_TYPE
    void OnLibraryPreferencesRemoveFileTypeUpdate( wxUpdateUIEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_PREFERENCES_RESET
    void OnLibraryPreferencesResetClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_DEFAULT_DESIGN
    void OnLibraryDefaultDesignClick( wxCommandEvent& event );

    /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_LIBRARY_CONSOLIDATE
    void OnLibraryConsolidateClick( wxCommandEvent& event );

    /// wxEVT_UPDATE_UI event handler for ID_LIBRARY_CONSOLIDATE
    void OnLibraryConsolidateUpdate( wxUpdateUIEvent& event );

////@end AxLibrarySettingsPage event handler declarations

////@begin AxLibrarySettingsPage member function declarations

    /// Retrieves bitmap resources
    wxBitmap GetBitmapResource( const wxString& name );

    /// Retrieves icon resources
    wxIcon GetIconResource( const wxString& name );
////@end AxLibrarySettingsPage member function declarations

    /// Should we show tooltips?
    static bool ShowToolTips();

////@begin AxLibrarySettingsPage member variables
    wxTextCtrl* m_pathCtrl;
    wxListBox* m_additionalPathsCtrl;
    wxCheckListBox* m_fileTypesCtrl;
    /// Control identifiers
    enum {
        ID_AXLIBRARYSETTINGSPAGE = 11000,
        ID_LIBRARY_PREFERENCES_MAIN_PATH = 11001,
        ID_LIBRARY_PREFERENCES_MAIN_PATH_BROWSE = 11002,
        ID_LIBRARY_PREFERENCES_ADDITIONAL_PATH = 11003,
        ID_LIBRARY_PREFERENCES_ADD = 11004,
        ID_LIBRARY_PREFERENCES_REMOVE = 11005,
        ID_LIBRARY_PREFERENCES_FILE_TYPES = 11006,
        ID_LIBRARY_PREFERENCES_ADD_FILE_TYPE = 11007,
        ID_LIBRARY_PREFERENCES_REMOVE_FILE_TYPE = 11008,
        ID_LIBRARY_PREFERENCES_RESET = 11009,
        ID_LIBRARY_DEFAULT_DESIGN = 11010,
        ID_LIBRARY_CONSOLIDATE = 11011
    };
////@end AxLibrarySettingsPage member variables

    bool                        m_canConsolidate;
    AxResourceLibrarySettings*  m_settings;
    AxResourceLibrary*          m_library;
};

#endif
    // _AX_SETTINGS_LIBRARYPAGE_H_
